I discovered that the Magic SysRq key Ctrl + Alt + PrtScr + r frees the keyboard after such errors. I don't know if it's a "good" way in technical terms, though. :)
I'll be honest the Sega Master System version of Rampage is really good.
It is indeed. I've also found that if you set
sync_resample internal
in /opt/retropie/configs/mame-advmame/advmame.rc, then the audio tends to behave itself in AdvanceMAME. As a result, 'Rampage' runs really well for me there.